package com.cloud.logger.zchain.zchainserver.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.cloud.logger.zchain.zchainserver.entity.propertyenum.UserStatusEnum;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Email;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.persistence.Id;
import javax.validation.constraints.Pattern;

/**
 * User: wcy
 * Date: 2017/11/2
 * Time: 11:28
 */
@Data
@Document(collection="zchain_user")
public class ZchainUser {

    @Id
    private String id;

    @JsonProperty("org_id")
    @JSONField(name = "org_id")
    @ApiModelProperty(name = "org_id", notes = "机构id", example = "xxx")
    private String orgId;

    @JsonProperty("user_name")
    @JSONField(name = "user_name")
    @ApiModelProperty(name = "user_name", notes = "用户名", example = "zs")
    private String userName;

    @JsonProperty("password")
    @JSONField(name = "password")
    @ApiModelProperty(name = "password", notes = "用户密码", example = "zs")
    private String password;

    @JsonProperty("employee_name")
    @JSONField(name = "employee_name")
    @ApiModelProperty(name = "employee_name", notes = "员工名", example = "张三")
    private String employeeName;

    @JsonProperty("status")
    @JSONField(name = "status")
    @ApiModelProperty(name = "status", notes = "状态（admin超级管理员/simple普通用户）", example = "admin")
    private UserStatusEnum status;

    @JsonProperty("phone")
    @JSONField(name = "phone")
    @ApiModelProperty(value = "电话", example = "13344566677", required = true)
    @Pattern(regexp = "^((13[0-9])|(15[^4,\\D])|(17[^4,\\D])|(18[^4,\\D]))\\d{8}$", message = "手机号格式不正确")
    private String phone;

    @Email
    @JsonProperty("email")
    @JSONField(name = "email")
    @ApiModelProperty(value = "邮箱", example = "836327318@qq.com")
    private String email;

}
